UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hNbvksC31UcSrscOeWXRZ3EDB9PuUzoZr7s1eU6OU+Q='
WHERE
key_id = '42497c7438c3c86348112045e359e29efe1ad178cd597fa5d20b00662e4aa7f0'
AND (
token = 'hNbvksC31UcSrscOeWXRZ3EDB9PuUzoZr7s1eU6OU+Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)