UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nOsY5ATx+pHafOpjJtDLZGfshHF4kysagIt3/MkurTs=' 
WHERE 
  key_id = 'c2dc54accea8d67ed1eb200b56a4648596fc530036da170f25060df3a1f269c6' 
  AND (
    token = 'nOsY5ATx+pHafOpjJtDLZGfshHF4kysagIt3/MkurTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044