UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mzex1m0YohJBCal0k2halaDD0NlbycEDpJWrAEUbn64=' 
WHERE 
  key_id = '0d0026e86b5934d76cee160363adfb6366b0af77e662fe1bf847489ea5774793' 
  AND (
    token = 'Mzex1m0YohJBCal0k2halaDD0NlbycEDpJWrAEUbn64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031