UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd+heLUiCi2PzlCQ33WLKKNkh891xunSPk6Upr0pQqL4='
WHERE
key_id = '7460ad45dc2f221e4a0f4254ac3de57ba9fc0d7cc3843247b54475651587084a'
AND (
token = 'd+heLUiCi2PzlCQ33WLKKNkh891xunSPk6Upr0pQqL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)