UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KxYAPiV+Ycy75UEqrKpTMRxwW/RfhTqLYV1ZtjRVmas=' 
WHERE 
  key_id = '3609a82ba029f3705b84375be65a765f91eb3a76f776416ebdf498859c3f6a56' 
  AND (
    token = 'KxYAPiV+Ycy75UEqrKpTMRxwW/RfhTqLYV1ZtjRVmas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016