UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJQtERtnyN1iu+hAlkqgP/UosxBv226lRCnL0lyYfvY=' 
WHERE 
  key_id = '3990f4cc9561c102bf3af84819c899ec5658f422c539b5b3e16fdcf15cf32c63' 
  AND (
    token = 'XJQtERtnyN1iu+hAlkqgP/UosxBv226lRCnL0lyYfvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044