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