UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u8r2QmHNV+83bl4QCJ2VVAyGYm0mQoCbWv/X2B8VEoo=' 
WHERE 
  key_id = '0f5c8b4239afde78c0baf63d55de239e7f1ecf265a36f84e301cab6ca3197ef2' 
  AND (
    token = 'u8r2QmHNV+83bl4QCJ2VVAyGYm0mQoCbWv/X2B8VEoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028