UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z6XWr2JNcBrpXfAdhqrEbgkg18oUEVolj0TXs6gCfAQ=' 
WHERE 
  key_id = '1b65de56d96057b7b202fe9e9e3081315445670551d329a3ee14c7870104ca01' 
  AND (
    token = 'Z6XWr2JNcBrpXfAdhqrEbgkg18oUEVolj0TXs6gCfAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033