UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f8uk5SDcUeBsm5ndBe8Ol398mo2kMUb6OiQPp5fMs00='
WHERE
key_id = '5309df3dc556adf33b14fb21cecbf599e153fc231fd8a2130853ac50df2765e9'
AND (
token = 'f8uk5SDcUeBsm5ndBe8Ol398mo2kMUb6OiQPp5fMs00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)