UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lXjjQgUc+vP6U7csgMkyxzAiep1aydhsESAn77lS4J8=' 
WHERE 
  key_id = '42aefd6f915d1e2f88e9244f76d56af582d0c3101261a83fbb99128e218c17e6' 
  AND (
    token = 'lXjjQgUc+vP6U7csgMkyxzAiep1aydhsESAn77lS4J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031