UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F9+82Q+K+QFLWskxnyWdIOnWvDhqeGjQXJdzNu2fBgg='
WHERE
key_id = 'a878be728b0e1d5e7ede664dda6e2328a385d343487dcd96bb329b06fee9b3fe'
AND (
token = 'F9+82Q+K+QFLWskxnyWdIOnWvDhqeGjQXJdzNu2fBgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)