UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKzJGzoUjUpbSNjNqN+UEdw/Y7elbN6WzTfp6Xi7uHk=' 
WHERE 
  key_id = '742d44c5e9a67bea3ebee030b04c951c177266794301ef0ce9fc93c3d145ffd2' 
  AND (
    token = 'pKzJGzoUjUpbSNjNqN+UEdw/Y7elbN6WzTfp6Xi7uHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018