UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BossaU2Pl4sWv9FIPEoPaMXyeNmm8o+VIxXFwLABQYs='
WHERE
key_id = 'aeb6b9082fbbee8a246b72fda715ff38b0adb53572b709d9c3dea2715e5451f1'
AND (
token = 'BossaU2Pl4sWv9FIPEoPaMXyeNmm8o+VIxXFwLABQYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)