UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TZOBSAvrqF1hZ+XwCUGocO3qzBr99bxf59A4bdFCL+M='
WHERE
key_id = '742250ae7f2397f42e618ecda5f6aeb65a1d3db3ce09324bede3456d67ee76a4'
AND (
token = 'TZOBSAvrqF1hZ+XwCUGocO3qzBr99bxf59A4bdFCL+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)