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

Query time 0.00028