UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQd4LyM/NKFEa/CmSdsGc0M/P25Jsxk22VZy+qMEvE8=' 
WHERE 
  key_id = '8796dc0b5fbc8d9fb2d6c60154a2e28a70408666845e39750b731f9ec85d77cf' 
  AND (
    token = 'TQd4LyM/NKFEa/CmSdsGc0M/P25Jsxk22VZy+qMEvE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044