UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XXd/8tiYdm6/J8K4tBvi5ApEdv21KZ48WCADC2YBRSs='
WHERE
key_id = 'd76fad4411e9f92b8f378faf611664857c88132f483dd9e7452a554b52314308'
AND (
token = 'XXd/8tiYdm6/J8K4tBvi5ApEdv21KZ48WCADC2YBRSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)