UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bg8W4DfiLmnyAM/TXDgnZp0PsGfm98md/U9VJz52eGM=' 
WHERE 
  key_id = '84126808c2777d09f25e8a75d73df5dece9cc2418c5f3c727186327e68e9ea50' 
  AND (
    token = 'Bg8W4DfiLmnyAM/TXDgnZp0PsGfm98md/U9VJz52eGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027