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