UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r8SkPw4Ceo53vFj1rZfw2USknuPC61MaNJwj69F1sGA='
WHERE
key_id = '0d84fc2695bb0a82e9b33e59d50a544d039495d46255e72b620fcbab8cdde899'
AND (
token = 'r8SkPw4Ceo53vFj1rZfw2USknuPC61MaNJwj69F1sGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)