UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YpvOdto9Iat7du6r6ZZVx5vDFSUfIYeQsa0oFZnank=' 
WHERE 
  key_id = 'a9f7eb906d28522f56ba937ab5623a1dbed22f0adf3e84fb1b79e3dde0e32337' 
  AND (
    token = '5YpvOdto9Iat7du6r6ZZVx5vDFSUfIYeQsa0oFZnank=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034