UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBq5fAEQxiaYN7VuhQ6bZyGBfaiiE7mpKz2eg+viB1A=' 
WHERE 
  key_id = '32992090f37884e2c11f08d41c8fa1a3129592f489c0096dc1df42052461d30d' 
  AND (
    token = 'fBq5fAEQxiaYN7VuhQ6bZyGBfaiiE7mpKz2eg+viB1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032