UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w1xMXSlVwNYooPqKrN9/JpbVScxnPFymVEZYzFdoOJw=' 
WHERE 
  key_id = '677013c4c9b5e42a2bd77afeec956234a6c8e5358671ce541aa51827f45426c6' 
  AND (
    token = 'w1xMXSlVwNYooPqKrN9/JpbVScxnPFymVEZYzFdoOJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023