UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mOD3GZdVCw5fEzrYnjnB5zBqvEBsl0SwSFhv1wTVzSU=' 
WHERE 
  key_id = '9e06a1d86508605d910b8741bf53dd45de3beae45848122a9c5d7b46c07b675c' 
  AND (
    token = 'mOD3GZdVCw5fEzrYnjnB5zBqvEBsl0SwSFhv1wTVzSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032