UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SuWj7zQSjWzs03uz5TtkCcP3zB44GECz3evJbT2uIxo=' 
WHERE 
  key_id = '8f637c9a5504902db16726f4bd676ed9e7b4349d13f67bb741c40a9ccdafcb6f' 
  AND (
    token = 'SuWj7zQSjWzs03uz5TtkCcP3zB44GECz3evJbT2uIxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039