UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WbDyMZ0FGU5wqVlE12PfjpGRrYaN0N28iukLAiBS8b8='
WHERE
key_id = 'f4d34870855de36bfa7e3941b4854c879a5747c6b1f4324e6e7ac2eab9b31b1d'
AND (
token = 'WbDyMZ0FGU5wqVlE12PfjpGRrYaN0N28iukLAiBS8b8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)