UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ep45fzk3BjKGZXmT+m2H0z6Fcyylh4nPare5GaRhBUo=' 
WHERE 
  key_id = 'bda192b910e7899f9b67f2357cefc22961374d965fa5ca8b8b7c749cab159236' 
  AND (
    token = 'Ep45fzk3BjKGZXmT+m2H0z6Fcyylh4nPare5GaRhBUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027