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

Query time 0.00023