UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r6CozRE66kwii74uIQsmZloP8Q7+mhvYVI+yOnWGUvA='
WHERE
key_id = '330969a5848dacf1196b109c8e14bab6b031955c6c6d342b7bb9b200ac3e237e'
AND (
token = 'r6CozRE66kwii74uIQsmZloP8Q7+mhvYVI+yOnWGUvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)