UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O8GdmqLEgD/tCZXtxy91cg+n3ZnlF6m7cK7uJmisb20=' 
WHERE 
  key_id = 'dd47ee381ce155896fa9b6ba958e0299f7fa338dc4248a6ba78a854af10f6f9b' 
  AND (
    token = 'O8GdmqLEgD/tCZXtxy91cg+n3ZnlF6m7cK7uJmisb20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034