UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vW8DzEMW945mGz16AviwxrgrsKH4VpWuk5sYYM4VvpU='
WHERE
key_id = '2678503876b111372bd315eb83ea8dd267b75d37386c0853268c1dfb6182a3b1'
AND (
token = 'vW8DzEMW945mGz16AviwxrgrsKH4VpWuk5sYYM4VvpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)