UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+AGDY8+ydy9oAfc2OmctRCcV6E3DLXfAKBRhUvr2Ybs='
WHERE
key_id = 'b424b82d88d2360b01b01ce363888cd48700fbd4e2816a45466a4daf2dc2edc9'
AND (
token = '+AGDY8+ydy9oAfc2OmctRCcV6E3DLXfAKBRhUvr2Ybs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)