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

Query time 0.00046