UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rpHBDpVa1kRiY4OMQruYuv8RdIVtNifUUy4cy6QIltQ=' 
WHERE 
  key_id = '7edf14e15c8f87fb37fb88113cde3a0a5c922b2b7fbadade51b5326a817e08ad' 
  AND (
    token = 'rpHBDpVa1kRiY4OMQruYuv8RdIVtNifUUy4cy6QIltQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042