UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n3VRXYF6u6ykkubJfsiwDdpH5asT1yIq5DtTh0n08F0='
WHERE
key_id = '272e64b1466269a4daf20a710479daa6dc2bd5163097248957b6b35f319a0d50'
AND (
token = 'n3VRXYF6u6ykkubJfsiwDdpH5asT1yIq5DtTh0n08F0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)