UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hw5BccZiSIg/oB9QcER8Aoivjmytk4h43hy2aWXAfXg='
WHERE
key_id = '149170ece5339961843eeb9f8fc177acc249b2d863c2a83c32b9e60353c122a6'
AND (
token = 'Hw5BccZiSIg/oB9QcER8Aoivjmytk4h43hy2aWXAfXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)