UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7+5mWc4tJ9vh23EWRI27IL62XP1hac1YlyN+OvzSLE8=' 
WHERE 
  key_id = '898aa57698b9a17e512f52a1a8c55dab0babd6f97e79c9959af2707b478fcdd4' 
  AND (
    token = '7+5mWc4tJ9vh23EWRI27IL62XP1hac1YlyN+OvzSLE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050