UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a/5HnSiaG0jINgCrEXlJkHehGBumo1c4YMc57XJkJOY='
WHERE
key_id = 'd270045cc3964e758d986908c2758af9ba4f40975e3cfdfc1f020f7592f72bdd'
AND (
token = 'a/5HnSiaG0jINgCrEXlJkHehGBumo1c4YMc57XJkJOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)