UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm1dpbgw1ztUMp2PI15tTCuNIQZzMP3C+uVv0C3Hl+zU='
WHERE
key_id = '8f84696486e8022cb7b45e95a75913e2d94883e11ed654f3b7767e7321dde952'
AND (
token = 'm1dpbgw1ztUMp2PI15tTCuNIQZzMP3C+uVv0C3Hl+zU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)