UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h/JCjP+bDtpKNCU3Ybr+irnuyxD4ahCFknaR//0rX88='
WHERE
key_id = '371c19ceb07ca6ba2c29cb021d49506fad2dd1dee8b0e880d84023702398ba80'
AND (
token = 'h/JCjP+bDtpKNCU3Ybr+irnuyxD4ahCFknaR//0rX88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)