UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oub0I4VICxoSJ92UaShi3owzmkSv6Cq6+QajR5Lfrgk='
WHERE
key_id = '4c81ff55d270d58ef0c9b07f575952ddb29a1625ad088b985243a675d8398c1e'
AND (
token = 'oub0I4VICxoSJ92UaShi3owzmkSv6Cq6+QajR5Lfrgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)