UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XLJZP3dQwaFC4vGiJqP8LYSiJimtKJubyF8o5BJQuQs='
WHERE
key_id = '400b3fc3d783674f3139231f2d257c847e8ca243846d8b60473a33f4e29831d7'
AND (
token = 'XLJZP3dQwaFC4vGiJqP8LYSiJimtKJubyF8o5BJQuQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)