UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mxPUyqtw0N8TTB3JFmJWNFh055bPmUYySpCNtI5Mcb0='
WHERE
key_id = 'b694b6a609a8413678c791bbbc38157c844214e81be50254c9970e9f64375aa1'
AND (
token = 'mxPUyqtw0N8TTB3JFmJWNFh055bPmUYySpCNtI5Mcb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)