UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NR1jWpFipuUwzJuoLnJ0vb+QP6rI9S0hTjov00t2nfs='
WHERE
key_id = '6f7f5ff322df4608f15c0d58f84f5932c8866d5f8fdb4717f9c7c173212c8bda'
AND (
token = 'NR1jWpFipuUwzJuoLnJ0vb+QP6rI9S0hTjov00t2nfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)