UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E5/pDZVwcY3z6jpb+FmyGs1nc+3C9QEyBnGCcFwxZHc='
WHERE
key_id = '9cd618bd149fc09c17ce42d834964e1a0c9054a9517245978ee3a9a260a65ec8'
AND (
token = 'E5/pDZVwcY3z6jpb+FmyGs1nc+3C9QEyBnGCcFwxZHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)