UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dHDB02KtESuxND5veHZCyb+HUS0fq54Achuwsot9rQw=' 
WHERE 
  key_id = '594eb1ac24c85e580458f7882bdc8b712805ba637fd6272a47911569678fe276' 
  AND (
    token = 'dHDB02KtESuxND5veHZCyb+HUS0fq54Achuwsot9rQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028