UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EfA5BpzsbcW6x/out+2Nm4eZhtlhcEs25uoLzXrfz+Y=' 
WHERE 
  key_id = '2a217b444fe440313ef9635d3d641747629aa4f88551087b99c53574530e67e0' 
  AND (
    token = 'EfA5BpzsbcW6x/out+2Nm4eZhtlhcEs25uoLzXrfz+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018