UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NVo0R1z4pZqZlSakWn3+NYRpRdB3VgXnxRqfcSV+3ew=' 
WHERE 
  key_id = 'f1e3cf1b054063fee6f38356d1531e8bdfd2e898b3391e4db89a9fff432b3b7d' 
  AND (
    token = 'NVo0R1z4pZqZlSakWn3+NYRpRdB3VgXnxRqfcSV+3ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037