UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmg+S+/bPF0OcEAlXr53GUu3AY1p4Owe/Aq8BKXUVCs=' 
WHERE 
  key_id = 'dde87b1c8383ff6bbb0887dd0f696088931f2c81483ce44ce59f59300cd26454' 
  AND (
    token = 'qmg+S+/bPF0OcEAlXr53GUu3AY1p4Owe/Aq8BKXUVCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029