UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wcZW7icz0gjokxsCz7C6k4+iIMeB87umjz0/x/Nq2i8='
WHERE
key_id = 'a04dd8de4cb0d85407b0aed076d35bafe41aa6bcc06c671fe9bc3e5d7069bdce'
AND (
token = 'wcZW7icz0gjokxsCz7C6k4+iIMeB87umjz0/x/Nq2i8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)