UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'exBZQ8lPoI1/oXcecwfmM/dNonyVNkbRbyJ+P+c+V8g='
WHERE
key_id = '9efc365918eeeffadc9c58cebb7069575f95425e07f9b4596d19a849d5a239d4'
AND (
token = 'exBZQ8lPoI1/oXcecwfmM/dNonyVNkbRbyJ+P+c+V8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)