UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8w6+fPsu7TU66lzopdtyFk1YOk6LZfFvWXxwjXmlrvM='
WHERE
key_id = 'd3d788c600382b163190add35e1567b9db575d4bc428ab1ec6f7f3da7c74721c'
AND (
token = '8w6+fPsu7TU66lzopdtyFk1YOk6LZfFvWXxwjXmlrvM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)