UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0m8aRhEi5xcUHZ0HqEvW6aRRQJwR6jrBSi/GRiNin4=' 
WHERE 
  key_id = 'b23d6a1cba8d3e8a60c61c7553488f130475d29d48775fcf142ca4c7ab54d563' 
  AND (
    token = 'a0m8aRhEi5xcUHZ0HqEvW6aRRQJwR6jrBSi/GRiNin4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040