UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h4h6iuZ74AXlzWBxXIheYNBKkEI2jMWqlhZtfY647X0=' 
WHERE 
  key_id = 'f0392a3522610171cb45fc65c38a8837bacf4f04f948200e897feb235d1f4ef5' 
  AND (
    token = 'h4h6iuZ74AXlzWBxXIheYNBKkEI2jMWqlhZtfY647X0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024