UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RMu27Ep4Z618viQ8qwiUSTukllUDqN9z8qjClQNA1O0=' 
WHERE 
  key_id = '4cb3073f0812e353500153cd6b99964b0e5940650be787e891d992c4eb6d1f17' 
  AND (
    token = 'RMu27Ep4Z618viQ8qwiUSTukllUDqN9z8qjClQNA1O0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017