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